package com.ribbon.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
//需要注意的是：nacos-ribbon、nacos-feign请求接口需要加上命名空间
@RequestMapping("/ribbon")
@RestController
public class RibbonController {

    @Autowired
    RestTemplate restTemplate;

    @GetMapping("/hi")
    public String hi(){
        return restTemplate.getForObject("http://nacos-provider/hi?name=来自于Ribbon客户端的",String.class);
    }

}
